package com.ly.algorithm.leetcode.hashtable;

import java.util.HashMap;

/**
 * @Classname Problem217
 * @Description TODO
 * @Date 2020/12/19 22:39
 * @Author 冷心影翼
 */
public class Problem217 {

	public static void main(String[] args) {
		Solution217 solution217 = new Solution217();
		System.out.println(solution217.containsDuplicate(new int[]{1, 2, 3, 4,2}));
	}
}


class Solution217 {
	public boolean containsDuplicate(int[] nums) {
		HashMap<Integer,Integer> hashMap = new HashMap<>();
		for(int i=0;i<nums.length;i++) {
			if(hashMap.containsKey(nums[i]))
				return true;
			hashMap.put(nums[i],1);
		}
		return false;
	}
}